'use strict';

const mediaStreamContrains = {
    video: {
        frameRate: { min: 20 },
        width: { min: 640, ideal: 1280 },
        height: { min: 360, ideal: 720 },
        aspectRatio: 16 / 9
    },
    audio: {
        echoCancelled: true,
        noiseSuppression: true,
        autoGainControl: true
    }
};
var localVideo = document.getElementById('local-video');
function getLocalMediaStream(mediaStream) {
    if (window.URL) {
        localVideo.srcObject = window.srcObject = mediaStream;
    } else {
        localVideo.srcObject = mediaStream;
    }
}
function handleLocalMediaStreamError(error) {
    console.log('navigator.getUserMedia error:', error);
}
function start() {
    navigator.mediaDevices.getUserMedia(mediaStreamContrains).then(
        getLocalMediaStream
    ).catch(
        handleLocalMediaStreamError
    );
}

function stop() {
    localVideo.srcObject.getTracks()[0].stop();
    localVideo.srcObject.getTracks()[1].stop();
}
